Create an Azure Pipelines task wrapper#1248
Closed
mjcheetham wants to merge 4 commits intogit-for-windows:mainfrom
Closed
Create an Azure Pipelines task wrapper#1248mjcheetham wants to merge 4 commits intogit-for-windows:mainfrom
mjcheetham wants to merge 4 commits intogit-for-windows:mainfrom
Conversation
Introduce a simple abstraction of the @actions/core module, such that we can provide a different implementation in the future (for Azure Pipelines, for example). Rename 'run' to 'setup' (which is the sibling to 'cleanup'), and add a new 'run' function that takes only an ICore implementation, using @actions/core. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
In a similar way to @actions/core, we abstract the @actions/cache functions. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Move the shared orchestration logic of the action out of main.ts into a new file src/action.ts. The main.ts file now just calls through to the run() function, with an ICore instance using @actions/core and @actions/cache. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
d113708 to
52b0db4
Compare
Introduce a new sub-package that is an Azure Pipelines task, that wraps the logic from the GitHub action. Most of the @actions/core functions have 1:1 equivalents in Azure Pipelines, so we can easily port the action logic into an Azure task instead. @actions/cache doesn't have the same integration, but consumers can use the Cache@2 task directly in their pipeline YAML instead. Note that due to difference in the task/action definition schema, some of the input names cannot be exactly the same. Namely the `github-token` action input is not a valid task input, due to the '-'. We maintain a mapping of GitHub Actions -> Azure Pipelines input names and do the translation in our ICore implemention. Running `npm run build` followed by `npm run package` will use `ncc` to compile all the task code into a single index.js file, and then use the `tfx` CLI to create a VSIX extension that can be published to the Azure DevOps Marketplace. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #1247
Introduce a new sub-package that is an Azure Pipelines task, that wraps the logic from the GitHub action.
Most of the
@actions/corefunctions have 1:1 equivalents in Azure Pipelines, so we can easily port the action logic into an Azure task instead.@actions/cachedoesn't have the same integration, but consumers can use theCache@2task directly in their pipeline YAML instead.Note that due to difference in the task/action definition schema, some of the input names cannot be exactly the same. Namely the
github-tokenaction input is not a valid task input, due to the '-'. We maintain a mapping of GitHub Actions ➡️ Azure Pipelines input names and do the translation in ourICoreimplementation.Running
npm run buildfollowed bynpm run packagewill usenccto compile all the task code into a single index.js file, and then use thetfxCLI to create a VSIX extension that can be published to the Azure DevOps Marketplace.